#include "dataBase.h"

int initDataBase(MYSQL* mysql,const dataBase_t database) {
    mysql = mysql_init(NULL);
    MYSQL* ret = mysql_real_connect(mysql,database.host,database.user,database.passwd,database.db,0,NULL,0);
    // MYSQL* ret = mysql_real_connect(mysql,"localhost","root","123","test",0,NULL,0);
    if(ret == NULL) {
        fprintf(stderr,"%s:%s\n","mysql_real_connect",mysql_error(mysql));
        return -1;
    }
    return 0;
}
int closeDataBase(MYSQL* mysql) {
    mysql_close(mysql);
    return 0;
}